package com.ruoyi.qiushi.service.user.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.qiushi.domain.user.MemberPointRecord;
import com.ruoyi.qiushi.mapper.user.MemberPointRecordMapper;
import com.ruoyi.qiushi.service.user.IMemberPointRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 用户积分记录Service业务层处理
 *
 * @author ruoyi
 * @date 2023-12-28
 */
@Service
public class MemberPointRecordServiceImpl implements IMemberPointRecordService {
    @Autowired
    private MemberPointRecordMapper memberPointRecordMapper;

    /**
     * 查询用户积分记录
     *
     * @param id 用户积分记录主键
     * @return 用户积分记录
     */
    @Override
    public MemberPointRecord selectMemberPointRecordById(Long id) {
        return memberPointRecordMapper.selectMemberPointRecordById(id);
    }

    /**
     * 查询用户积分记录列表
     *
     * @param memberPointRecord 用户积分记录
     * @return 用户积分记录
     */
    @Override
    public List<MemberPointRecord> selectMemberPointRecordList(MemberPointRecord memberPointRecord) {
        return memberPointRecordMapper.selectMemberPointRecordList(memberPointRecord);
    }

    /**
     * 新增用户积分记录
     *
     * @param memberPointRecord 用户积分记录
     * @return 结果
     */
    @Override
    public int insertMemberPointRecord(MemberPointRecord memberPointRecord) {
        memberPointRecord.setCreateTime(DateUtils.getNowDate());
        return memberPointRecordMapper.insertMemberPointRecord(memberPointRecord);
    }

    /**
     * 修改用户积分记录
     *
     * @param memberPointRecord 用户积分记录
     * @return 结果
     */
    @Override
    public int updateMemberPointRecord(MemberPointRecord memberPointRecord) {
        memberPointRecord.setUpdateTime(DateUtils.getNowDate());
        return memberPointRecordMapper.updateMemberPointRecord(memberPointRecord);
    }

    /**
     * 删除用户积分记录信息
     *
     * @param id 用户积分记录主键
     * @return 结果
     */
    @Override
    public int deleteMemberPointRecordById(Long id) {
        return memberPointRecordMapper.deleteMemberPointRecordById(id);
    }
}
